package com.songlanyun.modules.useraddress.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.songlanyun.common.drive.RootEntity;
import com.songlanyun.common.validator.group.AddGroup;
import com.songlanyun.common.validator.group.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

/**
 * 会员的收货地址表
 *
 * @author lubo
 * @email sunlightcs@gmail.com
 * @date 2020-11-11 14:49:27
 */
@Data
@TableName("yxt_sale_user_address")
public class UserAddress extends RootEntity<Long,UserAddress> implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 *
	 */
	@TableId
	@NotNull(message="修改时必须指定商品分组Id",groups = {UpdateGroup.class})
	@Null(message = "新增时不能指定商品分组Id",groups = {AddGroup.class})
	private Long id;
	/**
	 *
	 */
	@NotNull(message="必须有会员",groups = {AddGroup.class,UpdateGroup.class})
	private Long userId;
	/**
	 * 收货人姓名
	 */
	@NotBlank(message="收货人姓名不能为空",groups = {AddGroup.class,UpdateGroup.class})
	@Length(min = 1,max = 20,message = "收货人姓名长度在1-20个字",groups = {AddGroup.class,UpdateGroup.class})
	private String name;
	/**
	 * 联系电话
	 */
	@NotBlank(message="收货人联系电话不能为空",groups = {AddGroup.class,UpdateGroup.class})
	@Length(min = 1,max = 20,message = "收货人联系电话长度在1-20个字",groups = {AddGroup.class,UpdateGroup.class})
	private String phone;
	/**
	 * 详细地址
	 */
	@NotBlank(message="收货人详细地址不能为空",groups = {AddGroup.class,UpdateGroup.class})
	@Length(min = 1,max = 200,message = "收货人详细地址长度在1-200个字",groups = {AddGroup.class,UpdateGroup.class})
	private String address;


	/**
	 * 省名
	 */
	@Length(max = 20, message = "省名长度在20个字", groups = {AddGroup.class, UpdateGroup.class})
	private String provinceName;
	/**
	 * 省编号
	 */
	@Length(max = 20, message = "省编号长度在20个字", groups = {AddGroup.class, UpdateGroup.class})
	private String provinceCode;
	/**
	 * 市名
	 */
	@Length(max = 20, message = "市名长度在20个字", groups = {AddGroup.class, UpdateGroup.class})
	private String cityName;
	/**
	 * 市编号
	 */
	@Length(max = 20, message = "市编号长度在20个字", groups = {AddGroup.class, UpdateGroup.class})
	private String cityCode;
	/**
	 * 区名
	 */
	@Length(max = 20, message = "区名长度在1-20个字", groups = {AddGroup.class, UpdateGroup.class})
	private String areaName;
	/**
	 * 区编号
	 */
	@Length(max = 20, message = "区编号长度在20个字", groups = {AddGroup.class, UpdateGroup.class})
	private String areaCode;


	/**
	 * 是否是默认
	 */
	private Boolean isDefault;
	/**
	 * 经度
	 */
	@Length(max = 30, message = "经度长度在30个字", groups = {AddGroup.class, UpdateGroup.class})
	private String longitude;

	/**
	 * 经度
	 */
	@Length(max = 30, message = "经度长度在30个字", groups = {AddGroup.class, UpdateGroup.class})
	private String latitude;

	@TableField(fill = FieldFill.INSERT)
	private Date createTime;
	/**
	 *
	 */
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private Date updateTime;

	@Override
	public Long getIdentity() {
		return getId();
	}
}
